part of '../repository.dart';

const _kPaymentRequestRedirectConfirmationInfoReturnUrlKey = 'return_url';
const _kPaymentRequestRedirectConfirmationInfoLocaleKey = 'locale';

class _PaymentRequestRedirectConfirmationInfoDto extends Equatable
    implements _PaymentRequestConfirmationInfoDto {
  const _PaymentRequestRedirectConfirmationInfoDto._internal({
    required this.returnUrl,
    required this.locale,
  });

  final String returnUrl;
  final String locale;

  @override
  String get type => _kPaymentRequestRedirectConfirmationInfoTypeValue;

  @override
  List<Object?> get props {
    return [
      returnUrl,
      locale,
    ];
  }

  factory _PaymentRequestRedirectConfirmationInfoDto.fromEntity(
      YookassaApiPaymentRequestRedirectConfirmationInfo confirmationInfo) {
    return _PaymentRequestRedirectConfirmationInfoDto._internal(
      returnUrl: confirmationInfo.returnUrl,
      locale: confirmationInfo.locale,
    );
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      _kPaymentRequestConfirmationInfoTypeKey: type,
      _kPaymentRequestRedirectConfirmationInfoReturnUrlKey: returnUrl,
      _kPaymentRequestRedirectConfirmationInfoLocaleKey: locale,
    };
  }
}
